Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hypervisor default as cache mode for disk offerings #10282

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

hsato03
Copy link
Collaborator

@hsato03 hsato03 commented Jan 27, 2025

Description

Currently, ACS provides none, write-back and write-through options as cache mode when creating disk offerings.

This PR adds the option Hypervisor default as an alternative to cache mode. By using this option, the KVM hypervisor will choose the cache mode to be used by the disk.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

Disk offering creation

Screenshot from 2025-01-27 12-13-00

Compute offering with compute only disk offering creation

Screenshot from 2025-01-27 12-14-10

How Has This Been Tested?

  1. I created a disk offering and a compute offering with compute only disk offering using the Hypervisor default as cache mode;
  2. I deployed a VM for each offering from step 1;
  3. I verified through virt-manager that the disk of both VMs was using the Hypervisor default cache mode, as in the screenshot below.

Screenshot from 2025-01-27 12-23-58

@hsato03
Copy link
Collaborator Author

hsato03 commented Jan 27, 2025

@blueorangutan package

@blueorangutan
Copy link

@hsato03 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 16.15%. Comparing base (864751d) to head (a20b6d5).

Files with missing lines Patch % Lines
...g/apache/cloudstack/storage/to/VolumeObjectTO.java 0.00% 4 Missing ⚠️
...datastore/adapter/ProviderAdapterDiskOffering.java 0.00% 4 Missing ⚠️
...src/main/java/com/cloud/offering/DiskOffering.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #10282   +/-   ##
=========================================
  Coverage     16.15%   16.15%           
- Complexity    13263    13265    +2     
=========================================
  Files          5666     5666           
  Lines        497960   497965    +5     
  Branches      60241    60242    +1     
=========================================
+ Hits          80459    80470   +11     
+ Misses       408499   408486   -13     
- Partials       9002     9009    +7     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.00% <10.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12225

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

Copy link

github-actions bot commented Feb 7, 2025

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@JoaoJandre
Copy link
Contributor

@hsato03 could you solve the conflicts?

api/src/main/java/com/cloud/offering/DiskOffering.java Outdated Show resolved Hide resolved
Comment on lines 168 to 169
enum DiskCacheMode {
NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
HYPERVISOR_DEFAULT("hypervisor_default"), NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this enum multiple times? Maybe we could extract it to a common place?

Copy link
Collaborator Author

@hsato03 hsato03 Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the DiskOffering.DiskCacheMode enum, it represents the value of the users input in an API call. On the other hand, the LibvirtVMDef.DiskCacheMode enum represents the value that will be used in the VM XML. In this case, the value of the HYPERVISOR_DEFAULT field is slightly different between these enums.

Concerning the ProviderAdapterDiskOffering.DiskCacheMode, it could be refactored to use the DiskOffering.DiskCacheMode enum, but I think this can be done in another PR since there are other enums that could be reused in this class.

@hsato03
Copy link
Collaborator Author

hsato03 commented Feb 14, 2025

@blueorangutan package

@blueorangutan
Copy link

@hsato03 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants